home *** CD-ROM | disk | FTP | other *** search
- /*
- * an interface for using TIFF files with QuickDraw.
- */
-
-
- /*
- * record of relevant information gained by scanning the TIFF fields.
- */
-
-
- /*
- * this is from the TIFF 5.0 document of 8/8/88
- */
-
- /* first eight bytes of a TIFF file: */
- struct TIFFHeader{
- short byteOrder; /* 0x4949: little-endian; 0x4d4d: big-endian */
- short versionNumber; /* always 42 */
- unsigned long offset; /* to first Image File Directory */
- };
-
- #define LittleEndian 0x4949
- #define BigEndian 0x4d4d
-
- /*
- * an Image File Directory has 2 bytes with the number of entries,
- * then the entries, then 4 bytes of offset to the next IFD, or 0.
- */
- struct TIFFEntry{
- short tag;
- short type; /* TIFF_BYTE, TIFF_ASCII, TIFF_SHORT, TIFF_LONG, TIFF_RATIONAL */
- long length; /* really a count */
- long offset; /* offset in file, or value if <= 4 bytes */
- };
-
- #define TIFF_BYTE 1 /* 8-bit unsigned integer */
- #define TIFF_ASCII 2 /* ascii string; last byte is null */
- #define TIFF_SHORT 3 /* 16 bit unsigned integer */
- #define TIFF_LONG 4 /* 32-bit unsigned integer */
- #define TIFF_RATIONAL 5 /* two longs: numerator, denominator */
-
- /* the entry types */
- #define ColorMap 320
- #define NewSubfileType 254
- #define ImageWidth 256
- #define ImageLength 257
- #define BitsPerSample 258
- #define Compression 259
- #define NoCompression 1
- #define LZWCompression 5
- #define PackCompression 32773
- #define PhotometricInterpretation 262
- #define PIZeroIsWhite 0
- #define PIZeroIsBlack 1
- #define PIRGB 2
- #define PIPalette 3
- #define StripOffsets 273
- #define SamplesPerPixel 277
- #define RowsPerStrip 278
- #define StripByteCounts 279
- #define XResolution 282
- #define YResolution 283
- #define PlanarConfiguration 284
- #define PCContiguous 1 /* RGBRGB... */
- #define PCPlanar 2 /* RR...GG...BB... */
- #define ResolutionUnit 296
- #define Predictor 317
- #define NoPredictor 1
- #define HDPredictor 2
-
-
- struct TIFFInfo{
- short ref; /* Mac file reference */
- short byteOrder; /* LittleEndian or BigEndian */
- long offset; /* of this Image File Directory */
- long nextOffset; /* of next Image File Directory */
- OSErr err;
- Str255 errStr;
-
- long *bitsPerSample; /* [samplesPerPixel] */
- CTabHandle colorMap;
- long compression;
- long predictor;
- long imageLength;
- long imageWidth;
- long photometricInterpretation;
- long planarConfiguration;
- long rowsPerStrip;
- long samplesPerPixel;
- long *stripByteCounts;
- long stripsPerImage;
- long *stripOffsets; /* [# of strips] */
- };
- typedef struct TIFFInfo *TIFFPtr;
-
-
- TIFFPtr ScanTIFF (short ref);
- void DisposeTIFF (TIFFPtr);
- OSErr DrawTIFF (short ref, TIFFPtr ti, Rect sr, Rect dr, short dither);
- OSErr GetTIFFError (TIFFPtr, StringPtr);
- short UnLZW (char *in, long inlen, char *out, long outlen);
- Boolean TIFFDrawable (TIFFPtr ti);
- PixMapHandle PalettePixMap (short depth, CTabHandle cth, long x, long y, long width, long height,
- Ptr data, long row);